<div id="sum"></div>
<div id="strong"></div>
<!-- <textarea name="" id="copy" cols="30" rows="10"></textarea> -->
<script>
  const aDay = 24 * 60 * 60 * 1000;
  let start = new Date("2021-10-28 00:00:00").getTime();
  const end = new Date("2022-01-01 00:00:00").getTime();
  const dates = [];
  // for (let i = 0; i < 65; i++) {
  //   dates.push(getDate(start + aDay * i));
  // }
  while (start < end) {
    dates.push(getDate(start));
    start += aDay;
  }
  strong.innerHTML = dates
    .map((i) => {
      return `<div class="day">
  <span>${i}</span>
</div>`;
    })
    .reduce((pre, cur) => {
      return pre + cur;
    });
  //   copy.value = JSON.stringify(dates);
  const dayLength = document.querySelectorAll(".day").length;
  sum.innerHTML = `${dayLength} ${dayLength}/7 = ${dayLength / 7}`;
  function getDate(tStamp) {
    const date = new Date(tStamp);
    const year = date.getFullYear();
    const month = ("0" + (date.getMonth() + 1)).slice(-2);
    const day = ("0" + date.getDate()).slice(-2);
    return `${year}-${month}-${day}`;
  }
</script>
